package main

// 相邻不能种花
// 能否种入n朵花

func canPlaceFlowers(flowerbed []int, n int) bool {
	flowerbed = append([]int{0}, append(flowerbed, 0)...) // 首尾添加0，避免考虑边界
	// tmp := make([]int,len(flowerbed)+2)
	// copy(tmp[1:len(flowerbed)+2], flowerbed)
	for i := 1; i < len(flowerbed)-1; i++ {
		if flowerbed[i-1] == 0 && flowerbed[i] == 0 && flowerbed[i+1] == 0 {
			flowerbed[i] = 1
			n--
		}
	}
	return n <= 0
}
